<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <f:view contentType="text/html">
        <h:head>
            <title>
                <ui:insert name="title">#{i18n['application.name']}</ui:insert>
            </title>
            <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
            <link type="text/css" rel="stylesheet" href="#{request.contextPath}/resources/css/default.css" />
            <link type="text/css" rel="stylesheet" href="#{request.contextPath}/themes/cupertino/skin.css" />
            <style type="text/css">
                body {
                    background: url(./resources/images/macosx/macback.png) no-repeat;
                    margin: 0;
                    padding: 0;
                    font-family: geneva, arial, helvetica, sans-serif;
                    font-size:80%;
                }
                .appleIcon {
                    background: url(./resources/images/macosx/apple.png) no-repeat 20%;
                }
                .dialog {
                    width:500px;
                    height: 500px;
                }
            </style>
            <script type="text/javascript">
                              function handleLogin(xhr,status,args) {      
                                 
                                      if(!args.success) {
                                              jQuery('#loginDlg').parent().effect("shake", { times:5 }, 100);
                                      } else {
                                              loginDialog.hide();
                                      }

                              }
            </script>
            <p:resource name="/jquery/jquery.js" />
            <p:resource name="/jquery/plugins/effects/effects.js" />
        </h:head>
        <h:body>
            <p:growl id="growl" showDetail="true" life="3000"/>

            <h:form>
                <p:idleMonitor timeout="180000" update="growl" onidle="loginDialog.show();setting.hide();retail.hide();inventory.hide();employee.hide();settlement.hide();" idleListener="#{loginBean.idleListener}"/>
                <p:menubar>
                    <p:submenu labelStyleClass="appleIcon" label="&nbsp;">
                        <p:menuitem value="登录" url="#" onclick="loginDialog.show();"></p:menuitem>
                        <p:menuitem value="修改密码" url="#" onclick="loginDialog.show();"></p:menuitem>
                        <p:menuitem value="退出" update="growl" actionListener="#{loginBean.logout}" oncomplete="if(args.success) {loginDialog.show();}"></p:menuitem>
                    </p:submenu>

                    <p:submenu label="系统设置">
                        <p:menuitem value="部门设置" url="faces/view/admin/showDepartments.xhtml" styleClass="open" target="settingFrame" onclick="setting.show();"></p:menuitem>
                        <p:menuitem value="系统设置" url="faces/view/admin/showProperties.xhtml" styleClass="open" target="settingFrame" onclick="setting.show(); "></p:menuitem>
                        <p:menuitem value="商品设置" url="faces/view/admin/showCommodities.xhtml" styleClass="open" target="inventoryFrame" onclick="inventory.show(); "></p:menuitem>
                        <p:menuitem value="财务设置" url="#" styleClass="open"></p:menuitem>
                    </p:submenu>

                    <p:submenu label="库存管理">
                        <p:menuitem value="商品出库" url="faces/view/inventory/commodity/showShootingOrders.xhtml" styleClass="open" target="inventoryFrame" onclick="inventory.show();" />
                        <p:menuitem value="库存商品" url="faces/view/inventory/commodity/showInventory.xhtml" styleClass="open" target="inventoryFrame" onclick="inventory.show();" />
                        <p:menuitem value="采购申请" url="faces/view/inventory/commodity/showPurchaseForms.xhtml" styleClass="open" target="inventoryFrame" onclick="inventory.show();" />
                    </p:submenu>
                    <p:submenu label="财务管理">
                        <p:menuitem value="结算历史记录"  url="faces/view/finance/settlement/showPostings.xhtml" target="settlementFrame" onclick="settlement.show();" />
                        <p:menuitem value="工资结算"  url="faces/view/finance/settlement/showPostings.xhtml" target="settlementFrame" onclick="settlement.show();" />
                    </p:submenu>
                    <p:submenu label="人事管理">
                        <p:menuitem value="员工设置" url="faces/view/employment/showEmployees.xhtml" styleClass="open" target="employeeFrame" onclick="employee.show();"></p:menuitem>
                        <p:menuitem value="薪酬管理" url="faces/view/employment/showPayrolls.xhtml" styleClass="open" target="employeeFrame" onclick="employee.show();"></p:menuitem>
                    </p:submenu>

                </p:menubar>
            </h:form>


            <p:dialog id="loginDlg" header="#{i18n['application.name']}" closable="false" resizable="false" draggable="false" hideEffect="explode" visible="true"  modal="true" widgetVar="loginDialog" width="300" height="200" closeListener="#{loginBean.closeDialog}" onCloseUpdate="growl">
                <p:ajaxStatus  style="width:16px;height:16px;">
                    <f:facet name="start">
                        <h:graphicImage  value="/resources/images/ajaxloading.gif" />
                    </f:facet>
                    <f:facet name="complete">
                        <h:outputText value="" />
                    </f:facet>
                </p:ajaxStatus>
                <h:form>
                    <h:panelGrid columns="2" cellpadding="5" >
                        <h:outputLabel for="username" value="用户名: *"  />
                        <h:inputText id="username" value="#{loginBean.username}" required="true" requiredMessage="请输入用户名" />
                        <h:outputLabel for="password" value="密码: *"/>
                        <h:inputSecret value="#{loginBean.password}"  id="password" required="true"  requiredMessage="请输入密码"/>
                        <f:facet name="footer">
                            <p:commandButton id="loginBt" widgetVar="loginButton" value="登录" onclick="this.disabled=true; "   update="growl,loginBt" actionListener="#{loginBean.login}"  oncomplete="handleLogin(xhr,status,args); this.disabled=false;" style="padding: 0;margin: 0;"></p:commandButton>
                        </f:facet>
                    </h:panelGrid>
                </h:form>
            </p:dialog>

            <p:dialog widgetVar="setting"  width="600" height="400" header="系统设置" >
                <iframe id="settingFrame" height="100%" width="100%" frameborder="0" marginheight="0" marginwidth="0"></iframe>
            </p:dialog>

            <p:dialog widgetVar="retail"  width="1200" height="800" header="门市管理" >
                <iframe id="retailFrame" height="100%" width="100%" marginheight="0" marginwidth="0" frameborder="0"></iframe>
            </p:dialog>

            <p:dialog widgetVar="inventory" header="商品管理"   width="1024" height="768">
                <iframe id="inventoryFrame" height="100%" width="100%" marginheight="0" marginwidth="0" frameborder="0"></iframe>
            </p:dialog>
            <p:dialog widgetVar="employee" header="职员设置"   width="1024" height="768">
                <iframe id="employeeFrame" height="100%" width="100%" marginheight="0" marginwidth="0" frameborder="0"></iframe>
            </p:dialog>
            <p:dialog widgetVar="settlement" header="结算中心"   width="1024" height="768">
                <iframe id="settlementFrame" height="100%" width="100%" marginheight="0" marginwidth="0" frameborder="0"></iframe>
            </p:dialog>

            <p:dock>
                <p:menuitem value="客户资料" icon="/resources/images/macosx/trash.png" url="faces/view/retail/account/showAccounts.xhtml"  target="retailFrame" onclick="retail.show();"/>
                <p:menuitem value="客流量" icon="/resources/images/macosx/finder.png" url="faces/view/retail/lead/showLeads.xhtml" target="retailFrame" onclick="retail.show();"/>
                <p:menuitem value="拍照订单" icon="/resources/images/macosx/terminal.png"  url="faces/view/retail/order/showShootingOrders.xhtml" target="retailFrame" onclick="retail.show();"/>
                <p:menuitem value="拍照" icon="/resources/images/stack/aperture.png" url="faces/view/photograph/showShootingOrders.xhtml" target="retailFrame" onclick="retail.show();" />
                <p:menuitem value="后期制作" icon="/resources/images/stack/photoshop.png" url="faces/view/postProduction/showShootingOrders.xhtml" target="retailFrame" onclick="retail.show();" />
                <p:menuitem value="婚庆" icon="/resources/images/stack/finder.png" url="#" />
                <p:menuitem value="结算中心" icon="/resources/images/stack/coda.png" url="faces/view/finance/settlement/showSettlementForms.xhtml" target="settlementFrame" onclick="settlement.show();" />
            </p:dock>
        </h:body>


    </f:view>

</html>

